<html>
<head><meta charset="utf-8"><title>Help with unresolved type · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html">Help with unresolved type</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247724556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247724556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247724556">(Jul 30 2021 at 15:40)</a>:</h4>
<p>Hi guys I'm having issues with some unresolved type inferences, can someone help me ?</p>



<a name="247727005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247727005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fee1-dead <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247727005">(Jul 30 2021 at 15:58)</a>:</h4>
<p><a href="https://dontasktoask.com/">https://dontasktoask.com/</a></p>



<a name="247727759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247727759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> fee1-dead <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247727759">(Jul 30 2021 at 16:04)</a>:</h4>
<p>Please explain the issues that you are encountering, you can get people to help you that way :)</p>



<a name="247748123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247748123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Notification Bot <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247748123">(Jul 30 2021 at 18:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="429606">Phạm quang trung</span> has marked this topic as resolved.</p>



<a name="247750543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247750543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Notification Bot <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247750543">(Jul 30 2021 at 19:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> has marked this topic as unresolved.</p>



<a name="247899250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247899250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247899250">(Aug 02 2021 at 08:10)</a>:</h4>
<p>ok so, i have this code using gStreamer, and returning an unresolved type</p>



<a name="247899288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247899288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247899288">(Aug 02 2021 at 08:11)</a>:</h4>
<p>the method is the get trait of this structure <a href="https://docs.rs/gstreamer/0.17.1/gstreamer/structure/struct.Structure.html">https://docs.rs/gstreamer/0.17.1/gstreamer/structure/struct.Structure.html</a></p>



<a name="247899325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247899325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247899325">(Aug 02 2021 at 08:12)</a>:</h4>
<p>extern crate gstreamer as gst;</p>
<p>use gst::prelude::*;<br>
use gst::CAPS_FEATURES_MEMORY_SYSTEM_MEMORY;<br>
use gst::{StructureRef, CapsFeaturesRef};<br>
use gst::Caps as gstCaps;<br>
use serde::{Serialize, Deserialize};<br>
use std::collections::HashMap;</p>
<p>#[derive(Serialize, Deserialize)]<br>
pub struct StrCaps {<br>
    data_type: String,<br>
    data_format: String,<br>
    details: HashMap&lt;String, String&gt;<br>
}</p>
<p>fn from(gst_caps: &amp;gstCaps) -&gt; Vec&lt;StrCaps&gt; {<br>
    let caps_list: Vec&lt;StrCaps&gt; = Vec::new();</p>
<div class="codehilite"><pre><span></span><code>let feature_Count = gst_caps.size();
for i in 0..feature_Count {
    let structure: Option&lt;&amp;StructureRef&gt;  = gst_caps.structure(i);
    let features: Option&lt;&amp;CapsFeaturesRef&gt; = gst_caps.features(i);

    if structure.is_none() {continue;}
    let structure = structure.unwrap();

    // Get super type (video audio and codec eg:video/x-raw)
    if features.is_some() &amp;&amp; (
        features.unwrap().is_any() ||
        !features.unwrap().is_equal(&amp;CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)
    ){
        let features_string = String::from(features.unwrap().to_string());
    }

    let name = structure.name();

    for field in structure.fields() {
        let field_value = structure.get(field);
    }
}

return caps_list;
</code></pre></div>

<p>}</p>



<a name="247899359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247899359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247899359">(Aug 02 2021 at 08:13)</a>:</h4>
<p>In the detail the line:<br>
let field_value = structure.get(field);<br>
is evaluated to: result&lt;{unknown},GetError&gt;, and i have not idea of what to do.<br>
Do I have to perform some sort of cast or type, but i do not know hot to do that.<br>
I mean even if would like to store the result and cast it using a match case, rust do not allow me to go on with a unknown during compilation.</p>



<a name="247899426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247899426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247899426">(Aug 02 2021 at 08:15)</a>:</h4>
<p>I do not know how to handle this, someone can illuminate me ?</p>



<a name="247899577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247899577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247899577">(Aug 02 2021 at 08:19)</a>:</h4>
<p>i was thinking to match the result but i do now know the possible types</p>



<a name="247901002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247901002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247901002">(Aug 02 2021 at 08:44)</a>:</h4>
<p>if <code>cargo check</code> doesn't complain, this is a bug in rust-analyzer</p>



<a name="247901071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247901071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247901071">(Aug 02 2021 at 08:46)</a>:</h4>
<p>if it does complain, the compiler error message should hopefully give you a hint</p>



<a name="247907098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247907098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247907098">(Aug 02 2021 at 10:29)</a>:</h4>
<p>ok</p>



<a name="247907128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247907128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247907128">(Aug 02 2021 at 10:30)</a>:</h4>
<p>so the compiler complains ( i checked that wasn't the case too )</p>



<a name="247907147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247907147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247907147">(Aug 02 2021 at 10:30)</a>:</h4>
<p>error[E0284]: type annotations needed for <code>Result&lt;T, GetError&gt;</code><br>
  --&gt; src/dgi/caps.rs:43:35<br>
   |<br>
43 |                 let q = structure.get(field);<br>
   |                     -             ^^^ cannot infer type for type parameter <code>T</code> declared on the associated function <code>get</code><br>
   |                     |<br>
   |                     consider giving <code>q</code> the explicit type <code>Result&lt;T, GetError&gt;</code>, where the type parameter <code>T</code> is specified<br>
   |<br>
   = note: cannot satisfy <code>&lt;_ as FromValue&lt;'_&gt;&gt;::Checker == _</code></p>
<p>error: aborting due to previous error; 3 warnings emitted</p>



<a name="247907176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247907176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247907176">(Aug 02 2021 at 10:31)</a>:</h4>
<p>but still i do not the possible types</p>



<a name="247907212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247907212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247907212">(Aug 02 2021 at 10:32)</a>:</h4>
<p>or maybe i know i have to research the source code, i'll go in that direction for now</p>



<a name="247912053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247912053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247912053">(Aug 02 2021 at 11:50)</a>:</h4>
<p>I found some insights here, <a href="https://gtk-rs.org/gtk4-rs/stable/latest/book/gobject_values.html">https://gtk-rs.org/gtk4-rs/stable/latest/book/gobject_values.html</a></p>



<a name="247912080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Help%20with%20unresolved%20type/near/247912080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> SigMagiiK <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Help.20with.20unresolved.20type.html#247912080">(Aug 02 2021 at 11:50)</a>:</h4>
<p>you have to call get using :: in order to specify the function return type</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>